#include "detectorsendsystempacket.h"
#include "detectorprotocoldata.h"
#include "common/checkpacket.h"
#include "common/makepacket.h"
#include "common/pfcid.h"

namespace hplc
{
namespace qinfine
{

DetectorSendSystemPacket::DetectorSendSystemPacket(DetectorProtocolData &data)
{
    m_d = &data;
}

void DetectorSendSystemPacket::setCoil(quint8 flag)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_COIL, flag);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getCoil()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_COIL);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setTimeIntegral(quint16 timeInte)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_TIME_INTEGRAL, timeInte);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getTimeIntegral()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_TIME_INTEGRAL);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setRangeIntegral(quint8 rangeInteIndex)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_RANGE_INTEGRAL, rangeInteIndex);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getRangeIntegral()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_RANGE_INTEGRAL);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setAuFactor(float factor)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_AU_FACTOR, factor);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getAuFactor()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_AU_FACTOR);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setRasterStep(quint8 dir, quint32 step)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_RASTER_STEP, dir, step);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setHomeOffset(qint32 offset)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_HOME_OFFSET, offset);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getHomeOffset()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_HOME_OFFSET);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setWaveOffset(quint32 offset)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_WAVE_OFFSET, offset);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getWaveOffset()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_WAVE_OFFSET);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setWorkMode(quint8 mode, quint8 flag)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_WORKMODE, mode, flag);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getWorkMode()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_WORKMODE);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setWaveCalibDataCMD(quint8 cmd)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_WAVECALIB_DATA_CMD, cmd);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setWaveCalibData(float wave, float realWave)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_WAVECALIB_DATA, wave, realWave);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getWaveCalibData()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_WAVECALIB_DATA);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setLampUsedTime(quint32 time)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_LAMP_USED_TIME, time);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getLampUsedTime()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_LAMP_USED_TIME);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setLampOnOffTimes(quint16 times)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_LAMP_ONOFF_TIMES, times);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getLampOnOffTimes()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_LAMP_ONOFF_TIMES);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setLampCount(quint8 count)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_LAMP_COUNT, count);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getLampCount()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_LAMP_COUNT);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setDACZeroVoltage(float voltage)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_DAC_ZEROVOLTAGE, voltage);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getDACZeroVoltage()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_DAC_ZEROVOLTAGE);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setUploadObject(quint8 object)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_UPLOADOBJECT, object);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getUploadObject()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_UPLOADOBJECT);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setHomeTimeIntegral(quint16 timeInte)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_HOME_TIME_INTEGRAL, timeInte);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getHomeTimeIntegral()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_HOME_TIME_INTEGRAL);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setHomeRangeIntegral(quint8 rangeInteIndex)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_HOME_RANGE_INTEGRAL, rangeInteIndex);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::getHomeRangeIntegral()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_DETECTOR_EXT_SYSTEM), (quint8)PFC_DES_HOME_RANGE_INTEGRAL);
    m_d->m_checker->sendRetry();
}

void DetectorSendSystemPacket::setRefMin(quint32 min)
{

}

void DetectorSendSystemPacket::getRefMin()
{

}

void DetectorSendSystemPacket::setSamMin(quint32 min)
{

}

void DetectorSendSystemPacket::getSamMin()
{

}

} // qinfine
} // hplc
